
package com.prs.crm.action.oa;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.action.ReportAction;
import com.prs.crm.context.AppContext;
import com.prs.crm.domain.ca.work.ArticleTook;
import com.prs.crm.domain.ca.work.DemandInventory;
import com.prs.crm.domain.ca.work.ProcureStore;
import com.prs.crm.domain.oa.CheckWork;
import com.prs.crm.report.ExportConfig;
import com.prs.crm.report.ReportCell;
import com.prs.crm.report.ReportTable;


public class AttendanceManagementReportAction extends ReportAction {

	private static final long serialVersionUID = 1L;
	private PaginationSupport pagination;
	public PaginationSupport getPagination() {
		return pagination;
	}
	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	@Action(value="exportCheckWorkAddReport", results = { @Result(name = "success"
		,type="stream",params={"contentType","${contentType}","inputName","inputStream"
		,"bufferSize","1024","contentDisposition","filename=${outfileName}"}) })
	public String exportCheckWorkAddReport()
	{
		ReportTable table = new ReportTable("考勤报表");
		table.addCell(new ReportCell("姓名", "recorder.resume.name"));
		table.addCell(new ReportCell("日期", "recordTime"));
		table.addCell(new ReportCell("上午上班时间", "morningInTime"));
		table.addCell(new ReportCell("上午下班时间", "morningOutTime"));
		table.addCell(new ReportCell("下午上班时间", "afternoonInTime"));
		table.addCell(new ReportCell("下午下班时间", "afternoonOutTime"));
		table.addCell(new ReportCell("备注", "remark"));
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				CheckWork.class);
		this.setOutFilePath(this.getReportService().report(criteria, table, new ExportConfig(),this.getExportType()));
		return SUCCESS;
	}
	@Action(value="../exportCheckWorkAddReport1", results = { @Result(name = "success"
		,type="stream",params={"contentType","${contentType}","inputName","inputStream"
		,"bufferSize","1024","contentDisposition","filename=${outfileName}"}) })
	public String exportCheckWorkAddReport1()
	{
		ReportTable table = new ReportTable("考勤报表");
		table.addCell(new ReportCell("姓名", "recorder.resume.name"));
		table.addCell(new ReportCell("日期", "recordTime"));
		table.addCell(new ReportCell("上班时间", "morningInTime"));
		table.addCell(new ReportCell("下班时间", "morningOutTime"));
		table.addCell(new ReportCell("备注", "remark"));
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				CheckWork.class);
		this.setOutFilePath(this.getReportService().report(criteria, table, new ExportConfig(),this.getExportType()));
		return SUCCESS;
	}
	@Action(value="exportCheckWorkAddReport2", results = { @Result(name = "success"
		,type="stream",params={"contentType","${contentType}","inputName","inputStream"
		,"bufferSize","1024","contentDisposition","filename=${outfileName}"}) })
	public String exportCheckWorkAddReport2()
	{
		ReportTable table = new ReportTable("考勤报表");
		table.addCell(new ReportCell("姓名", "recorder.resume.name"));
		table.addCell(new ReportCell("日期", "recordTime"));
		table.addCell(new ReportCell("上午上班时间", "morningInTime"));
		table.addCell(new ReportCell("上午下班时间", "morningOutTime"));
		table.addCell(new ReportCell("下午上班时间", "afternoonInTime"));
		table.addCell(new ReportCell("下午下班时间", "afternoonOutTime"));
		table.addCell(new ReportCell("备注", "remark"));
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				CheckWork.class).add(Restrictions.eq("recorder.id", AppContext.getAccountContext().currentUser().getId()));
		this.setOutFilePath(this.getReportService().report(criteria, table, new ExportConfig(),this.getExportType()));
		return SUCCESS;
	}
	@Action(value="exportCheckWorkAddReport3", results = { @Result(name = "success"
		,type="stream",params={"contentType","${contentType}","inputName","inputStream"
		,"bufferSize","1024","contentDisposition","filename=${outfileName}"}) })
	public String exportCheckWorkAddReport3()
	{
		ReportTable table = new ReportTable("考勤报表");
		table.addCell(new ReportCell("姓名", "recorder.resume.name"));
		table.addCell(new ReportCell("日期", "recordTime"));
		table.addCell(new ReportCell("上班时间", "morningInTime"));
		table.addCell(new ReportCell("下班时间", "morningOutTime"));
		table.addCell(new ReportCell("备注", "remark"));
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(
				CheckWork.class).add(Restrictions.eq("recorder.id", AppContext.getAccountContext().currentUser().getId()));
		this.setOutFilePath(this.getReportService().report(criteria, table, new ExportConfig(),this.getExportType()));
		return SUCCESS;
	}
}
